import axios from '../model/axios'

// 获取新闻分类
export const getNewsCategoryApi = (params: any) => {
    return axios({
        method: "get",
        url: "/prod-api/press/category/list",
        params
    })
}

// 获取新闻列表
export const getNewsListApi = (params: any) => {
    return axios({
        method: "get",
        url: "/prod-api/press/press/list",
        params
    })
}

// 获取新闻详情
export const getNewsDetailApi = (id: number) => {
    return axios({
        method: "get",
        url: "/prod-api/press/press/" + id
    })
}

// 获取新闻点赞
export const getNewsLikeApi = (id: number) => {
    return axios({
        method: "put",
        url: "/prod-api/press/press/like/" + id,
        headers: {
            "Authorization": window.localStorage.getItem("token")
        }
    })
}

//  获取新闻评论列表
export const getNewsCommentsApi = (params: any) => {
    return axios({
        method: "get",
        url: "/prod-api/press/comments/list",
        params
    })
}

// 评论点赞
export const getCommentsLikeApi = (id: number) => {
    return axios({
        method: "put",
        url: "/prod-api/press/pressComment/like/" + id,
        headers: {
            "Authorization": window.localStorage.getItem("token")
        }
    })
}


// 发布新闻评论
export const ToNewsCommentsApi = (data: any) => {
    return axios({
        method: "post",
        url: "/prod-api/press/pressComment",
        data,
        headers: {
            "Authorization": window.localStorage.getItem("token")
        }
    })
}